package com.lkd.service.impl;

import com.lkd.service.UserJob;
import com.lkd.service.UserService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
@Slf4j
public class UserJobImpl implements UserJob {
    @Autowired
    private UserService userService;

    /**
     * 每日工作量列表初始化
     *
     * @param param
     * @return
     */
    @Override
    @XxlJob("workCountInitJobHandler")
    public ReturnT<String> workCountInitJobHandler(String param) {
        XxlJobLogger.log("每日工单量列表初始化");
        //工单初始化
        userService.workCountInit(LocalDateTime.now());
        return ReturnT.SUCCESS;
    }
}
